package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.dto.CourseTeacherDTO;
import com.xuecheng.api.content.model.vo.CourseTeacherVO;
import com.xuecheng.content.entity.CourseTeacher;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Created on 2021/04/06/10:21 周二
 *
 * @author Lantin
 */
@Mapper
public interface CourseTeacherConvert {


    CourseTeacherConvert INSTANCE = Mappers.getMapper(CourseTeacherConvert.class);


    @Mapping(source = "createDate", dateFormat = "yyyy-MM-dd HH:mm:ss", target = "createDate")
    CourseTeacherDTO courseTeacherVoToDTO(CourseTeacherVO vo);

    @Mappings({
            @Mapping(source = "courseTeacherId", target = "id")
    })
    CourseTeacher dtOToCourseTeacher(CourseTeacherDTO dto);

    @Mappings({
            @Mapping(source = "id", target = "courseTeacherId")
    })
    CourseTeacherDTO courseTeacherToDTO(CourseTeacher courseTeacher);

    List<CourseTeacherDTO> courseTeacherToDTOList(List<CourseTeacher> list);
}
